/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package _4_Mapper;

import _3_Object.SendPostObject;
import _5_DB.ConnectDB;
import java.sql.CallableStatement;
import java.sql.Connection;

/**
 *
 * @author DOM
 */
public class UpdatePostMapper {
    public static int up(SendPostObject sp)
    {  
        int retvl=-1;
        try
        {
            ConnectDB db = new ConnectDB();
            Connection con = db.getConnection();
            CallableStatement proc = null;
            proc = con.prepareCall("{call procSua1BaiViet(?,?,?)}");
            
            proc.setInt(1, sp.getUid()); //pID xài chung uID cho tiện
            proc.setString(2, sp.getTitle());
            proc.setString(3, sp.getContents());
            
            retvl = proc.executeUpdate();
        }
        catch( Exception ex)
        {
            System.out.print(ex.getMessage());
        }
        return retvl;
    }
}
